<template>
	<view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			}
		},
		onShow() {
			let that = this
			uni.login({
				provider: 'weixin',
				success: (wxres => {
					console.log("wxres",wxres)
					that.$api.request('/api/web/wxlogin','',{
						code: wxres.code
					}, failres => {
						uni.showToast({
							title: failres.msg,
							icon: "none"
						});
					}).then(res => {
						uni.setStorageSync('token', res.data.token);
						uni.setStorageSync('openid', res1.data.openid);
						uni.setStorageSync('userId', res.data.user.userId);
					})
				})
			})
		},
		methods: {
			
		}
	}
</script>

<style>

</style>
